<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="me.linczh.bank.bean.EmployeeBean" %>
<%@ page import="me.linczh.bank.bean.enums.Position" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
EmployeeBean user = null;
if (request.getSession().getAttribute("user") != null) {
	user = (EmployeeBean)request.getSession().getAttribute("user");
}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <base href="<%=basePath%>">
    
  <title>Bank4Mr.Wen</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<script type="text/javascript" src="public/js/jquery-1.10.2.min.js"></script>    
	<link rel="stylesheet" type="text/css" href="public/css/bootstrap.min.css">  
	<link rel="stylesheet" type="text/css" href="public/css/index.css">  
	<link rel="stylesheet" type="text/css" href="public/css/navlist.css">
	<script type="text/javascript" src="public/js/bootstrap.min.js"></script>
  </head>
  
  <body>
  <% if (user != null) { %>
  	<div class="main-container">
	  	<div class="user-container">
	  		<!-- div class="user-avatar pull-left"><a href="#"><img class="avatar-middle"/></a></div -->
	  		<div class="user-info pull-left">
	  			<div class="user-greed"><h1><%=user.getUsername() %><small>,欢迎</small></h1></div>
	  			<div>
	  				<% switch(user.getPosition()) {
	  						case OPERATOR: %>
	  				<span class="label label-primary">前台操作员</span>
	  				<% 	break;
	  						case MANAGER: %>
	  				<span class="label label-success">银行经理</span>
	  				<% 	break;
	  						case SUPERVISOR: %>
	  				<span class="label label-warning">银行总管</span>
	  				<% 	break;
	  						default: %>
	  				<span class="label label-danger">系统管理员</span>
	  				<% } %>
	  				<a class="btn btn-xs btn-default" href="logout.action">退出</a>
	  			</div>
	  		</div>
	  	</div>
	 		<div>
				<div class="sidebar-container">
					<div class="sidebar">
						<ul id="sidebar" class="nav">
						<% if (user.getPosition().equals(Position.ADMIN)) { %>
							<li><a href="viewpage.action?page=admin/employee">雇员管理</a></li>
						<% } else { %>
							<li><a href="viewpage.action?page=account/create">开户</a></li>
							<li><a href="viewpage.action?page=account/deposit">存款</a></li>
							<li><a href="viewpage.action?page=account/withdrawal">取款</a></li>
							<li><a href="viewpage.action?page=account/query">查询</a></li>
							<li><a href="viewpage.action?page=account/transfer">转账</a></li>
							<li><a href="viewpage.action?page=account/password">改密码</a></li>
							<li><a href="viewpage.action?page=account/operator">企业操作人</a></li>
							<li><a href="viewpage.action?page=account/delete">销户</a></li>
							<li><a href="viewpage.action?page=employee/report">报告</a></li>
						<% } %>
						</ul>
					</div>
				</div>
				<div class="content">
					<% if (request.getAttribute("contentpage") != null) {
								String contentpage = (String)request.getAttribute("contentpage");
								System.out.println(contentpage); %>
					<jsp:include page="<%=contentpage %>"></jsp:include>
					<% } %>
				</div>
				<div class="clearfix"></div>
			</div>
		</div>
	<% } else { %>
		<div class="login-container">
			<div class="login-box">
				<div class="row">
					<div class="col-xs-5 login-intro">
						<h2>Bank4Mr.W</h2>
						<p>
							THIS PROJECT IS FOR<br>
							OBJECT-ORIENTED<br>
							PROGRAMMING COURSE<br>
						</p>
					</div>
					<div class="col-xs-7">
						<form action="login.action" method="post">
							<div class="form-group">
		    				<label for="username">Username</label>
		    				<input class="form-control" name="username" id="username">
		  				</div>
		  				<div class="form-group">
		    				<label for="password">Password</label>
		    				<input type="password" class="form-control" name="password" id="password">
		  				</div>
		  				<button type="submit" class="btn btn-success pull-right">Login</button>
						</form>
					</div>
				</div>
			</div>
		</div>
	<% } %>
	<div class="footer">
		<p>&copy; 2013 | Linczh 13214069</p>
	</div>
  </body>
</html>
